<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/functionDefinition.xsl"?>
<function
  xmlns="http://xbrl.org/2008/function" 
  xmlns:reg="http://xbrl.org/2008/registry" 
  xmlns:xhtml="http://www.w3.org/1999/xhtml" 
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xbrli="http://www.xbrl.org/2003/instance" 
  xmlns:xlink="http://www.w3.org/1999/xlink" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  ">

  <lastUpdated moment="2010-09-09T00:00:00" />

  <owners>
    <reg:owner id="herm">
       <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
       <reg:email>fischer@markv.com</reg:email>
       <reg:assumedOwnership moment="2008-09-01T00:00:00" />
    </reg:owner>
  </owners>

  <summary>
    Returns a string containing the definition of the role, or an empty sequence if none.
  </summary>

  <documentation>
    To provide a human-readable definition for a role which may or may not have a definition, for the roleURI $role, use this XPath2 construct: "(xfi:role-definition($role),$role)[1]".  It will select the role definition if there is one, and otherwise show the role's URI.
  </documentation>

  <signature name="xfi:role-definition">

    <input name="role" type="xs:string">
      <xhtml:p>
        The subject role.
      </xhtml:p>
    </input>

    <input name="xbrlinstance" type="element(xbrli:xbrl)">
      <xhtml:p>
        This parameter is optional.  If absent the target XBRL instance provides the DTS for role definitions.
        If provided then the specified XBRL instance provides the DTS of the role definition.
      </xhtml:p>
    </input>

    <output type="xs:string?">
      <xhtml:p>
        Returns the definition (if found) or an empty sequence (if not found, or if no definition specified). If multiple roleTypes for this role are present in the DTS any one is returned at the discretion of the implementation.
      </xhtml:p>
    </output>
  </signature>

  <conformanceTest xlink:type="simple" xlink:href="90505 xfi.role-definition testcase.xml"/>

  <revisions>
    <reg:revision on="2008-12-12T00:00:00" by="herm">
      <xhtml:p>
        Created the function definition.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2009-12-12T00:00:00" by="herm">
      <xhtml:p>
        Removed reference to dynamically loaded instances from the xbrlinstance input and clarified description.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2010-09-07T00:00:00" by="herm">
      <xhtml:p>
        Incorporated feedback from Hitoshi Okumura.
        Changed output types to "?" for empty sequence result.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2010-09-09T00:00:00" by="herm">
      <xhtml:p>
        Changed role URI to string for cast-less coding and to be similar to fn:QName's $paramURI, an xs:string.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2011-03-24T08:00:00" by="herm">
      <xhtml:p>
        Incorporated feedback from Hitoshi Okumura.
        On optional xbrlinstance parameter's type, removed "?" from element(xbrli:xbrl) for uniformity with other functions in this suite.
      </xhtml:p>
    </reg:revision>
  </revisions>

</function>
